<%@ page language="java" contentType="text/html; charset=UTF-8"   pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta charset="UTF-8">
	<title>用户中心</title>
	<script type="text/javascript" src="/static/js/jquery-1.10.2.min.js"></script>
	<script type="text/javascript" src="/static/js/jquery.cookie.js"></script>
</head>
<body>

<script type="text/javascript">
 	var baseUrl = "http://127.0.0.1:8080/phoenix-apps-cms";
 
 	var hostName = window.location.hostname;
 	
 	
 	function getOneNewGoods(id){
 		$.ajax({
 			url:baseUrl+"/cmsNewGoods/getOneNewGoods/"+id,
 			type:'GET',
 			success:function(v){
 				$("#show").text("IdxNewGoodsRecommended [id=" + v.id + ", goodsId=" + v.goodsId
 							+ ", goodsName=" + v.goodsName + ", goodsPic=" + v.goodsPic
 							+ ", weight=" + v.weight + ", recommendContent="
 							+ v.recommendContent + ", status=" + v.status + ", onlineTime="
 							+ v.onlineTime + ", offlineTime=" + v.offlineTime + ", createTime="
 							+ v.createTime + ", updateTime=" + v.updateTime + "]");
 			}
 		})
 	}
 	
	function showNewGoodsPersist(){
 		$.ajax({
 			url:baseUrl+"/cmsNewGoods/getAllNewGoodsByOrder",
 			type:'POST',
 			data:{pageSize:25,pageNo:1},
 			success:function(res){
 				$("#show").text("");
 				$.each(res.items,function(i,v){
 					$("#show").append("IdxNewGoodsRecommended [id=" + v.id + ", goodsId=" + v.goodsId
 							+ ", goodsName=" + v.goodsName + ", goodsPic=" + v.goodsPic
 							+ ", weight=" + v.weight + ", recommendContent="
 							+ v.recommendContent + ", status=" + v.status + ", onlineTime="
 							+ v.onlineTime + ", offlineTime=" + v.offlineTime + ", createTime="
 							+ v.createTime + ", updateTime=" + v.updateTime + "]<br/>")
 				}) 
 			}
 		})
 	}
	function insertNewGoodsPersist(){
		$.ajax({
 			url:baseUrl+"/cmsNewGoods/addOneNewGoods",
 			type:'POST',
 			data:{recommendContent:"aaaa",status:1,offlineTime:new Date(),onlineTime:new Date((new Date().getTime())+10000)},
 			success:function(res){
 				$("#show").text("success");
 			},error:function(e1,e2){
 				$("#show").text(e2);
 				$("#show").append(e1.responseText);
 			}
 		})
 	}
	function updateNewGoodsPersist(){
		$.ajax({
 			url:baseUrl+"/cmsNewGoods/updateOneNewGoods",
 			type:'POST',
 			data:{id:114, goodsId:3, goodsName:"商品名称", goodsPic:"http://www.google.com", weight:1, recommendContent:"推荐语", status:2, onlineTime:new Date(1431401754), offlineTime:new Date(1431401764), createTime:new Date(1431401734), updateTime:new Date(1431401764)},
 			success:function(res){
 				$("#show").text(res.msg);
 			}
 		})
 	}
	function updateNewGoodsStatusPersist(rgoodId,status){
		$.ajax({
 			url:baseUrl+"/cmsNewGoods/updatePicNewGoodsStatus",
 			type:'POST',
 			data:{rgoodId:rgoodId,status:status},
 			success:function(res){
 				$("#show").text(res.msg);
 			}
 		})
 	}
	function updateNewGoodsListStatusPersist(list,status){
		$.ajax({
 			url:baseUrl+"/cmsNewGoods/updatePicNewGoodsStatusList",
 			type:'POST',
 			data:{list:list,status:status},
 			success:function(res){
 				$("#show").text(res.msg);
 			}
 		})
 	}
	
 </script>
<button onclick="getOneNewGoods(1)">show1测试</button><br>
<button onclick="showNewGoodsPersist()">show测试</button><br>
<button onclick="insertNewGoodsPersist()">insert测试</button><br>
<button onclick="updateNewGoodsPersist(2)">updateNewGoods测试</button><br>
<button onclick="updateNewGoodsStatusPersist(2,3)">updateStatus测试</button><br>
<button onclick="updateNewGoodsListStatusPersist('2,3',1)">updateListStatus测试</button><br>
查询结果:<div id="show"></div>

</body>
</html>